<template>
  <view class="home">
    <view class="header">
      <text>{{ getCurrentTimeGreetings }}，{{ currentUserName }}</text>
    </view>
    <view class="section" />
    <view class="footer-btn">
      <button>送亲朋</button>
      <button @tap="hanleSelfCheck">开始自测</button>
      <button>活动Banner</button>
    </view>
  </view>
</template>

<script lang="ts">
import "./index.less";
import Taro from "@tarojs/taro";

export default {
  data() {
    return {
      currentUserName: "用户名"
    };
  },
  computed: {
    getCurrentTimeGreetings: () =>
      new Date().getHours() > 12 ? "下午好" : "上午好"
  },
  methods: {
    navigateToWelcome() {
      Taro.navigateTo({
        url: "/pages/index/index"
      });
    },
    onPhoneNumberGet(e) {
      console.log(e);
    },
    gotoQuestionnaire() {
      Taro.navigateTo({
        url: "/pages/health-questionnaire/entry/index"
      });
    },
    hanleSelfCheck() {
      Taro.navigateTo({
        url: "/pages/user-info/index"
      })
    }
  },

  async created() {
  },
  mounted() {},

  // onLoad
  onLoad() {},

  // onReady
  onReady() {},

  // 对应 onShow
  onShow() {
    // Taro.login({
    //   success: function (res) {
    //     if (res.code) {
    //       //发起网络请求
    //       Taro.request({
    //         url: login,
    //         method:"POST",
    //         data: {
    //           code: res.code
    //         }
    //       })
    //     } else {
    //       console.log('登录失败！' + res.errMsg)
    //     }
    //   }
    // })
  },

  // 对应 onHide
  onHide() {},

  // 对应 onPullDownRefresh
  onPullDownRefresh() {}
};
</script>
